package com.haixiaoke.saas.repository.service.impl;

import java.util.List;

import cn.hutool.core.date.DateUtil;
import com.haixiaoke.saas.repository.mapper.HouseBannerMapper;
import com.haixiaoke.saas.repository.pojo.HouseBanner;
import com.haixiaoke.saas.repository.service.IHouseBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 公众号首页轮播图Service业务层处理
 *
 * @author qixi
 * @date 2024-03-25
 */
@Service
public class HouseBannerServiceImpl implements IHouseBannerService {
    @Autowired
    private HouseBannerMapper houseBannerMapper;

    /**
     * 查询公众号首页轮播图
     *
     * @param id 公众号首页轮播图主键
     * @return 公众号首页轮播图
     */
    @Override
    public HouseBanner selectHouseBannerById(Long id) {
        return houseBannerMapper.selectHouseBannerById(id);
    }

    /**
     * 查询公众号首页轮播图列表
     *
     * @param houseBanner 公众号首页轮播图
     * @return 公众号首页轮播图
     */
    @Override
    public List<HouseBanner> selectHouseBannerList(HouseBanner houseBanner) {
        return houseBannerMapper.selectHouseBannerList(houseBanner);
    }

    /**
     * 新增公众号首页轮播图
     *
     * @param houseBanner 公众号首页轮播图
     * @return 结果
     */
    @Override
    public int insertHouseBanner(HouseBanner houseBanner) {
        houseBanner.setCreateTime(DateUtil.date());
        return houseBannerMapper.insertHouseBanner(houseBanner);
    }

    /**
     * 修改公众号首页轮播图
     *
     * @param houseBanner 公众号首页轮播图
     * @return 结果
     */
    @Override
    public int updateHouseBanner(HouseBanner houseBanner) {
        houseBanner.setUpdateTime(DateUtil.date());
        return houseBannerMapper.updateHouseBanner(houseBanner);
    }

    /**
     * 批量删除公众号首页轮播图
     *
     * @param ids 需要删除的公众号首页轮播图主键
     * @return 结果
     */
    @Override
    public int deleteHouseBannerByIds(Long[] ids) {
        return houseBannerMapper.deleteHouseBannerByIds(ids);
    }

    /**
     * 删除公众号首页轮播图信息
     *
     * @param id 公众号首页轮播图主键
     * @return 结果
     */
    @Override
    public int deleteHouseBannerById(Long id) {
        return houseBannerMapper.deleteHouseBannerById(id);
    }
}
